-- $Id: xpa.ads,v 1.16 2005-12-31 16:57:27 bacon Exp $

with system.wch_con;
with ada.io_exceptions;
with ada.streams;

package xpa is

	-- data types
	subtype mchar is standard.character;
	subtype mstr  is standard.string;

	subtype wchar is standard.wide_character;
	subtype wstr  is standard.wide_string;

	subtype char  is wchar;
	subtype str   is wstr;

	--type offset is range 
	--	-(2 ** (standard'address_size - 1)) ..
	--	+(2 ** (standard'address_size - 1)) - 1;
	type offset is range 0 .. 2**standard'address_size;

	type byte is mod 2 ** standard'storage_unit;
	--type byte_array is array (offset range <>) of aliased byte;
	type byte_array is array (positive range <>) of aliased byte;
	
	-- exceptions
	device_error: exception renames ada.io_exceptions.device_error;
	end_error:    exception renames ada.io_exceptions.end_error;
	data_error:   exception renames ada.io_exceptions.data_error;
	status_error: exception renames ada.io_exceptions.status_error;
	mode_error:   exception renames ada.io_exceptions.mode_error;
	name_error:   exception renames ada.io_exceptions.name_error;
	use_error:    exception renames ada.io_exceptions.use_error;
	layout_error: exception renames ada.io_exceptions.layout_error;

	-- wide character encoding method
	WCEM_UTF8: system.wch_con.wc_encoding_method 
		renames system.wch_con.WCEM_UTF8;
	WCEM_EUC: system.wch_con.wc_encoding_method 
		renames system.wch_con.WCEM_EUC;
	WCEM_HEX: system.wch_con.wc_encoding_method 
		renames system.wch_con.WCEM_HEX;
	WCEM_BRACKETS: system.wch_con.wc_encoding_method 
		renames system.wch_con.WCEM_Brackets;

	default_wcem: system.wch_con.wc_encoding_method := WCEM_UTF8;

	-- character constants
	MC_NUL: aliased constant mchar := mchar'val(0);
	MC_NL:  aliased constant mchar := mchar'val(10);
	MC_CR:  aliased constant mchar := mchar'val(13);

	WC_NUL: aliased constant wchar := wchar'val(0);
	WC_NL:  aliased constant wchar := wchar'val(10);
	WC_CR:  aliased constant wchar := wchar'val(13);

	NUL: aliased constant char := char'val(0);
	NL:  aliased constant char := char'val(10);
	CR:  aliased constant char := char'val(13);
	
private
	procedure set_default_wcem;

end xpa;
